<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateArchiveAppendixs extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('archive_appendix', array('engine' => 'MyISAM', 'comment' => '员工档案附件表'));
        $table->addColumn('admin_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '用户id'))
            ->addColumn('archive_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '员工档案id'))
            ->addColumn('title', 'string', array('limit' => 120, 'null' => true, 'comment' => '附件名称'))
            ->addColumn('path', 'string', array('limit' => 225,'null' => true, 'comment' => '附件路径'))
            ->addColumn('suffix', 'string', array('limit' => 25,'null' => true, 'comment' => '文件后缀'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();



        $table = $this->table('archive_type', array('engine' => 'MyISAM', 'comment' => '员工档案所含资料类别表'));
        $table
            ->addColumn('name', 'string', array('limit' => 120, 'null' => true, 'comment' => '附件名称'))
            ->addColumn('status', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1正常)'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
